<template>

	<div class="login">

        <!--<div class="nav">-->
            <!--<span class="nav_span">HYMAX 智能控制整体解决方案提供商</span>-->
            <!--<p class="nav_p">华耀智能制造+</p>-->
        <!--</div>-->
        <!--<div class="bg"></div>-->
        <div class="form">
            <!--<div class="form_nav"></div>-->
            <p class="form_p1">佛山市华耀自动化科技有限公司</p>
            <p class="form_p2">MaxFusion 管控一体化平台</p>
            <div class="form_form">
                <Form ref="loginForm" :rules="ruleInline" :model="form1">
                   <FormItem prop="account">
                        <Input class="input" v-model="form1.account" placeholder="请输入用户名称">
                            <Icon type="ios-contact" slot="prefix" size="30" />
                        </Input>
                    </FormItem>
                    <FormItem prop="password">
                        <Input  class="input" type="password" v-model="form1.password" placeholder="请输入登录密码">
                            <Icon type="ios-lock" slot="prefix" size="30" />
                        </Input>
                    </FormItem>
                    <FormItem>
                        <Button class="btn" @click="handleLogin(false)" type="success">登录</Button>
                    </FormItem>
                </Form>
            </div>
        </div>
        <!--<p class="footerP">MaxFusion管控一体化及大数据中心分析平台</p>-->
        <!--<div class="foot">-->
        <!--<span class="footSpan">LEAN MESOGE 精益制造执行系统</span>-->
        <!--<span class="footSpan">生产全流程数字化监控</span>-->
        <!--<span class="footSpan">松耦合 单元模块化设计理念</span>-->
        <!--<p class="footP2">Copyright©华耀科技,All Rights Reserved.</p>-->
        <!--<p class="footP2">联系方式:0757-82537101或13829799266</p>-->
        <!--</div>-->
	</div>
</template>

<script>
	import {mapMutations, mapGetters} from 'vuex'
	import {requestPost} from "../../utils/js/HttpUtil.js"
  import router from '../../router/index'
	export default {
		data(){
		  return{
			  form1:{
				  account:"",
				  password:""
			  },
        warnings:{
			    remark:"",
          value:""
        },

			  actions:{
				  loginUrl: "/system/user/login",
          getParameters:"/system/parameter/getParameters"
			  },
			  ruleInline: {
						account: [
							{ required: true, message: '请输入账号', trigger: 'blur' }
						],
						password: [
							{ required: true, message: '请输入密码', trigger: 'blur' },
							{ type: 'string', min: 6, message: '密码长度不小于6位', trigger: 'blur' }
						]
			  }
		  }
	  },
	  methods:{
			...mapMutations([
				  'saveLoginInfo'
			]),
			handleLogin(nodesc){
				requestPost(this.actions.loginUrl,
					this.form1
				, (data) => {
				  this.saveLoginInfo(data.data);
				  router.push('/index')
           //window.open('/#/index')
				});
				requestPost(this.actions.getParameters,{},(data) => {
				  this.warnings.remark = data.data[0].remark;
				  this.warnings.value = data.data[0].value
          // console.log(this.warnings)
          this.$Notice.warning({
            title: this.warnings.remark,
            desc: nodesc ? '' : this.warnings.value
          });
        })

		  }
	  }

}
</script>

<style type="less" scoped="scoped">
.login{
    background-image: url("../../assets/bg.jpg");
    background-size: 100% 100%;
    background-position: 0 0;
    background-repeat: no-repeat;
    width:100%;
    height:100%;
    position:relative;
    border:1px solid rgba(0,0,0,0);
}
.nav{
    width:100%;
    height:200px;
    margin-top:40px;
}
.nav_span{
    font-size:15px;
    color:#57ba9e;
    font-weight:600;
    letter-spacing: 0;
    margin:100px;
}
.nav_p{
    font-size:40px;
    color:#57ba9e;
    font-weight:600;
    text-align: center;
    letter-spacing:10px;
    margin-left:-90px;
}
.bg{
    width:100%;
    height:250px;
    background-color:#57ba9e;
    z-index:-1;
}
.form{
    position: absolute;
    width:400px;
    height:300px;
    left:37%;
    top:180px;
    background: rgba(255,255,255);
    //border:1px solid #cccccc;
    box-shadow: 1px 1px 5px #cccccc;
}
.form_nav{
    width:100.1%;
    height:20px;
    margin:-0.2px;
    background:#57ba9e;
}
.form_p1{
    font-size:20px;
    color:#57ba9e;
    font-weight:600;
    text-align: center;
    margin-top:20px;
}
.form_p2{
    font-size:17px;
    color:#57ba9e;
    font-weight:600;
    text-align: center;
    margin-top:10px;
}
.form_form{
    margin-top:20px;
    width:100%;
    height:70%;
}
.footerP{
    font-size:18px;
    color:#cecece;
    text-align: center;
    margin-top:200px;
    font-weight:600;
    margin-left:-100px;
}
.foot{
    margin-top:50px;
}
.footSpan{
    font-size:17px;
    color:#cecece;
    font-weight:600;
    margin:9.5%;
}
.footP2{
    font-size:17px;
    color:#cecece;
    text-align: center;
    margin-top:10px;
    margin-left:-100px;
}
.input{
    margin-top:0px;
    width:80%;
    margin-left:10%;
}
.btn{
    top:0px;
    left:40px;
    position: absolute;
    width:80%;
    height:40px;
    background:#57ba9e;
}
.btn:hover{
    background:#57ba9e;
}
.ivu-input{
    height:60px;
    font-size:17px;
    margin-top:3px;
}
.ivu-icon{
   //margin-top:14px;
   //margin-left:1px;
}
.ivu-form-item-error-tip{
    margin-left:40px;
    font-size:15px;
}
</style>
